﻿using System;
using System.Collections.Generic;

namespace Terraria.Achievements
{
	// Token: 0x020004AA RID: 1194
	public class ConditionsCompletedTracker : ConditionIntTracker
	{
		// Token: 0x060027F1 RID: 10225 RVA: 0x0001BFCA File Offset: 0x0001A1CA
		public void AddCondition(AchievementCondition condition)
		{
			this._maxValue++;
			condition.OnComplete += this.OnConditionCompleted;
			this._conditions.Add(condition);
		}

		// Token: 0x060027F2 RID: 10226 RVA: 0x0001BFF8 File Offset: 0x0001A1F8
		private void OnConditionCompleted(AchievementCondition condition)
		{
			base.SetValue(Math.Min(this._value + 1, this._maxValue), true);
		}

		// Token: 0x060027F3 RID: 10227 RVA: 0x00495630 File Offset: 0x00493830
		protected override void Load()
		{
			for (int i = 0; i < this._conditions.Count; i++)
			{
				if (this._conditions[i].IsCompleted)
				{
					this._value++;
				}
			}
		}

		// Token: 0x040043FB RID: 17403
		private List<AchievementCondition> _conditions = new List<AchievementCondition>();
	}
}
